$(function () {
    //获取url的值？开始
    var url =  window.location.search;
    // console.log(url);
    //截取？后面的字符串
    var str = url.substr(1);
    // console.log(str);
    //以"="分割成数组
    var strArr = str.split("=");
    // console.log(strArr);
    var obj = {};
    //与对象的形式获取id值
    for (var i = 0; i < strArr.length; i++) { 
        obj[strArr[0]] = strArr[1];
    }
    // console.log(obj);
    var id = obj.id;
    // console.log(id);
    if (id < 20) {
        $.ajax({
            method: 'get',
            url: "http://193.112.55.79:9090/api/getdiscountproduct?productid=" + id + "",
            dataType: 'json',
            success: function (res) {
                  console.log(res);
                var html = template("mmbtp", res.result);
                $('.content').html(html);
            }
        })
    } else if (id >= 20) { 
        $.ajax({
            method: 'get',
            url: "http://193.112.55.79:9090/api/getmoneyctrlproduct?productid=" + id + "",
            dataType: 'json',
            success: function (res) {
                 console.log(res);
                var html = template("mmbtp", res.result);
                $('.content').html(html);
            }
        })
    }
    
})